<template>
  <div class="parking-record-view">
    <h1>停车记录管理</h1>
    <el-table :data="parkingRecords" style="width: 100%">
      <el-table-column prop="startTime" label="开始时间"></el-table-column>
      <el-table-column prop="endTime" label="结束时间"></el-table-column>
      <el-table-column prop="vehicleId" label="车辆ID"></el-table-column>
      <el-table-column prop="spotId" label="车位ID"></el-table-column>
      <el-table-column prop="fee" label="费用"></el-table-column>
      <el-table-column label="操作">
        <template v-slot:default="scope">
          <el-button @click="handleOpenEditDialog(scope.row)">编辑</el-button>
          <el-button type="danger" @click="handleDelete(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      parkingRecords: []  // 假设这是从API获取的停车记录数组
    };
  },
  methods: {
    handleOpenEditDialog(row) {
      // 编辑对话框逻辑，使用传入的 row 数据
      console.log('Editing:', row);
    },
    handleDelete(id) {
      // 删除逻辑，使用传入的 id
      console.log('Deleting record with id:', id);
      // 实际的删除操作逻辑，可能包括调用API等
    }
  }
}
</script>

<style scoped>
.parking-record-view {
  /* 样式代码 */
}
</style>
